package com.service.business.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.service.business.order.service.OrderProductHrComboPaddingService;
import com.service.dao.mapper.OrderProductHrComboPaddingMapper;
import com.service.dao.model.OrderProductHrComboPadding;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.math.BigDecimal;
import java.util.Date;

@Service("orderProductHrComboPaddingService")
public class OrderProductHrComboPaddingServiceImpl extends ServiceImpl<OrderProductHrComboPaddingMapper, OrderProductHrComboPadding> implements OrderProductHrComboPaddingService {
	/**
	 * @Description: 根据订单统计该订单已填充的生效算力
	 * @Author: ty
	 * @Date: 2021/6/9 12:25
	 * @param: [coinsName, memberId, startTime]
	 * @return: java.math.BigDecimal
	 */
	@Override
	public BigDecimal totalEffectPaddingHashRate(String coinsName, Integer memberId, Date startTime) {
		String startTimeStr = null;
		if(!ObjectUtils.isEmpty(startTime)){
			startTimeStr = DateFormatUtils.format(startTime, DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.getPattern());
		};
		return baseMapper.totalEffectPaddingHashRate(coinsName, memberId, startTimeStr);
	}
}
